package database

import (
	"example.com/gojwt/models"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

var DB *gorm.DB

func Connection() {
	conn, err := gorm.Open(mysql.Open("root:root@tcp(127.0.0.1:3306)/go_jwt"), &gorm.Config{})
	if err != nil {
		panic(err)
	}

	DB = conn

	conn.AutoMigrate(&models.User{})
}
